package zhieasy.cn.xpu_helper.controller.book_market;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import zhieasy.cn.common.utils.StorageUtil;
import zhieasy.cn.common.vo.ResultVO;

/**
 * @author DaHang
 * @date 2020/8/1 9:21
 * 用来获取二手书城上传图片token以及上传路径的controller
 */
@Api(tags = "图书接口" ,value = "图片上传接口")
@RequestMapping("/book-market/objectUpload")
@RestController()
public class BookMarketUploadController {
    @Autowired
    private StorageUtil storageUtil;

    /**
     * 获取上传object的路劲以及上传所需要携带的token
     * @return
     */
    @RequestMapping(value = "/getTokenAndUrl", method = RequestMethod.GET)
    @ApiOperation(value = "七牛云上传调用接口", notes = "获取跟七牛云服务器交互的token+每个图片应该上传的url路径"
        , produces = "application/json;charset=UTF-8")
    public ResultVO getTokenAndUrl(){
        return storageUtil.getTokenAndUrlInBookMarket();
    }
}
